
local mt = ac.skill['地穴突刺']
mt.targettype = '点'
mt.range = 600
mt.area = 400
mt.model1 = [[Abilities\Spells\Undead\Impale\ImpaleHitTarget.mdl]]

function mt:on_cast_shot()
    local hero = self.owner
    local target = self.target
    local point1 = hero:get_point()
    local point2 = target:get_point()
    local angle = point1/point2
    local damage = hero:get('攻击') * self.data1
    local lock = {}
    local time = 1
    hero:add_restriction '硬直'
    ac.wait(0,function()
        hero:play_animation('Morph')
    end)
    point1:effect{
        model = [[fdcd174428a0c65293cd271ce959629e.mdx]],
        angle = angle,
        time = time,
        height = 90,
    }
    ac.wait(time * 1000,function()
        hero:add_buff '位移'{
            time = 1,
            target = point1 - {angle,1200},
            on_move = function(buff,point)
                point:add_effect(self.model1,1)
                hero:aoe_damage(point,150,damage,self,function(unit)
                    if lock[unit.handle]==nil then
                        lock[unit.handle] = true
                        unit:add_buff '晕眩'{time=1}
                        unit:add_buff '击飞'{time=0.5}
                        return
                    end
                    return true
                end)
                return point:is_walkable(true)
            end,
            on_remove = function()
                hero:play_animation('Morph Defend')
                ac.wait(0,function()
                    hero:remove_restriction '硬直'
                end)
            end
        }
    end)
    
    
end
